Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

228
Views
Why is my Javascript function displaying my text as "null" when using createNodeText?

I'm creating a program which takes user input inside one html page and transfers that text into another html page. Here is my javascript code:

function fromIndex() {
    let b = document.getElementById("textbox").value;
    sessionStorage.setItem("textbox", b)
    console.log(b)
    
    let b2 = document.getElementById("bio").value;
    sessionStorage.setItem("bio", b2)
    console.log(b2)
}

function transferIndex() {
    var h = document.createElement("p");
    let t = document.createTextNode(sessionStorage.getItem("textbox"));
    h.appendChild(t);
    document.body.appendChild(h);

    var h2 = document.createElement("p");
    let getIndex2 = document.createTextNode(sessionStorage.getItem("bio"));
    h2.appendChild(getIndex2);
    document.body.appendChild(h2);
}

The issue I run into is that when the user clicks on the "Update" button on the second html page, the text the user inputted in the first page defaults to "null". For reference, the button in the first html page (transmitting page) calls the fromIndex() function, and the second html page button (the receiving page) calls the transferIndex() function.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!